package sw.mylife;

import sw.mylife.system.GuiAPI;
import sw.mylife.system.MyLog;
import sw.mylife.system.Prompt;
import sw.mylife.system.Skillbook;

/**
 * Die Gui Klasse verwaltet alle Aktivities und bildet die Instanzierte Schnittstelle zum SKillbook
 */

public class Gui implements GuiAPI{

	//Singleton
	final public static Gui myGui = new Gui();
	private Login activityLogin;
	private MyLife activityMyLife;
	
	public static Gui getMygui() {
		return myGui;
	}
	
	//Attribute
	private static final String LOGTAG = "Gui";
	
	Skillbook sb = Skillbook.getMySB();
	Gui g = Gui.getMygui();
	
	//Interne Methoden------------------------------

	//API-Overrides-------------------------------------
	
	@Override
	public void start(char type) {
		MyLog.v(LOGTAG, "Dialog Type Requested by Skillbook: " + type);
		switch(type){
		case Skillbook.GUI_MAIN: activityLogin.startMyLife(); break;
		case Skillbook.GUI_LOGIN: break;
		default: MyLog.e(LOGTAG, "Starten des Types \'"+type+"\' fehlgeschlagen. Unbekannter Type");
		}

		
	}
	
	@Override
	public void refresh(char type, Prompt prompt) {
		MyLog.v(LOGTAG, "Prompt Type \'"+prompt.getType()+"\' requested by the Skillbook for Dialog "  + type);
		if(prompt.getType()==Prompt.TYPE_LOGIN_ERROR){
			activityLogin.showLoginError();
		}
	}
	public void addActivityLogin(Login login) {
		this.activityLogin = login;
		
	}

}
